package com.taowan.xunbaozl.morning_speak.uiview.day01;

import android.test.AndroidTestCase;
import android.text.Html;
import android.util.TypedValue;

/**
 * Created by 杨观回 on 2016/3/27 0027.
 */
public class TestTextView extends AndroidTestCase {

    /**
     * 可设置html代码
     */
    public void example1() {
        android.widget.TextView textView = new android.widget.TextView(getContext());
        //textview1
        String html = "<font color='red'>I love android</font><br>";
        html += "<font color='#0000FF'><big><i>I love android</i></big></font><br><p>";
        html += "<big>百度</big>";
        CharSequence charSequence = Html.fromHtml(html);
        textView.setText(charSequence);
    }


    /**
     * setSize 默认为sp
     */
    public void example2() {
        /**
         *   public void setTextSize(float size) {
         *  setTextSize(TypedValue.COMPLEX_UNIT_SP, size);
         */
        android.widget.TextView textView = new android.widget.TextView(getContext());
        textView.setTextSize(20);//sp
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);//dp
    }



}
